//
//  FirstViewController.m
//  颜色block
//
//  Created by missummer on 15-4-10.
//  Copyright (c) 2015年 missummer. All rights reserved.
//

#import "FirstViewController.h"
#import "TwoViewController.h"
@interface FirstViewController ()
@property (nonatomic , strong) UILabel * basicLabel;
@end

@implementation FirstViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor orangeColor];
    UIButton * button = [UIButton buttonWithType:UIButtonTypeSystem];
    button.frame = CGRectMake(100, 100, 100, 100);
    button.backgroundColor = [UIColor cyanColor];
    [self.view addSubview:button];
    [button addTarget:self action:@selector(push) forControlEvents:UIControlEventTouchUpInside];
    _basicLabel = [[UILabel alloc] init];
    _basicLabel.frame = CGRectMake(100, 300, 100, 30);
    _basicLabel.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:_basicLabel];
}
- (void)push
{
    TwoViewController * twoVC = [[TwoViewController alloc] init];
    __weak typeof(self) weakSelf = self;
    /*
    twoVC.changeColor = ^{
        weakSelf.view.backgroundColor = [UIColor orangeColor];
    };
     */
    [twoVC returnColorAndText:^(UIColor *color1, UIColor *color2, NSString *str) {
        weakSelf.view.backgroundColor = color2;
        weakSelf.basicLabel.backgroundColor = color1;
        weakSelf.basicLabel.text = str;
    }];
//    [twoVC returnColor:^(UIColor *color) {
//        _basicLabel.backgroundColor = color;
//        weakSelf.view.backgroundColor = color;
//        
//    }];
//    
//    [twoVC returnText:^(NSString *str) {
//        _basicLabel.text = str;
//    }];
    [self.navigationController pushViewController:twoVC animated:YES];
}


@end
